package id.co.rho.scoring.cid.client.widgets;

import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.Label;
import com.extjs.gxt.ui.client.widget.button.Button;


/**
 * Created by IntelliJ IDEA.
 * User: bungrudi
 * Date: 10/4/11
 * Time: 2:58 AM
 */
public class YesNoDialog extends Dialog {

    private Button btYes;
    private Button btNo;

    public YesNoDialog(String title, String message) {
        super();
        setButtons(Dialog.YESNO);
        setTitle(title);
        add(new Label(message));

        btYes = (Button) getButtonBar().getItem(0);
        btNo = (Button) getButtonBar().getItem(1);

        setHideOnButtonClick(true);
        setClosable(false);
    }

    public void setOnYes(SelectionListener<ButtonEvent> listener) {
        btYes.addSelectionListener(listener);
    }

    public void setOnNo(SelectionListener<ButtonEvent> listener) {
        btNo.addSelectionListener(listener);
    }
}
